package com.example.administrator.capital.presenter;
import com.example.administrator.capital.R;
import com.example.administrator.capital.model.HomeModel;
import com.example.administrator.capital.model.base.IActionRequest;
import com.example.administrator.capital.model.bean.ErrorBean;
import com.example.administrator.capital.presenter.base.BasePresenter;
import com.example.administrator.capital.presenter.base.IViewBase;
import com.example.administrator.capital.presenter.base.IViewRequest;
import com.example.administrator.capital.url.Url;
import com.example.administrator.capital.utils.JsonUtils;
import com.example.administrator.capital.utils.LogUtils;
import com.lzy.okgo.OkGo;
import com.lzy.okgo.callback.StringCallback;
import com.lzy.okgo.model.Response;

/**
 * Created by Administrator on 2017/12/15 0015.
 *
 */

public class HomePresenter extends BasePresenter {
    private HomeModel mHomeModel;


    public HomePresenter(IViewBase iViewBase) {
        super(iViewBase);
        mHomeModel = new HomeModel();
    }

    /**
     * @param iViewRequest
     * 首页
     * */
    public void homePage(final IViewRequest<String> iViewRequest){
        mHomeModel.homePage(new IActionRequest<String>() {
            @Override
            public void failMsg(String var) {
                iViewRequest.onFailMsg(var);
            }

            @Override
            public void code(int code) {
                iViewRequest.onCode(code);
            }

            @Override
            public void success(Response<String> data) {
                iViewRequest.onSuccess(data);
            }

            @Override
            public void fail(Response<String> error) {

            }
        });
    }


    /**
     * @param iViewRequest
     * @param uid
     * 查询我的邀请接口
     */
    public void selective(final IViewRequest<String> iViewRequest,String uid){
        mHomeModel.selective(new IActionRequest<String>() {
            @Override
            public void failMsg(String var) {
                iViewRequest.onFailMsg(var);
            }

            @Override
            public void code(int code) {
                iViewRequest.onCode(code);
            }

            @Override
            public void success(Response<String> data) {
                iViewRequest.onSuccess(data);
            }

            @Override
            public void fail(Response<String> error) {

            }
        },uid);
    }

}
